package com.nulstudio.sppm.mapper;

import com.nulstudio.sppm.entity.NulRole;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.util.List;

/**
 * Mapper for authority related operations.
 * @author nullsty
 * @since 2.0
 */
@Mapper
public interface AuthorityMapper {

    /**
     * Select a role by its name, with authorities associated with it.
     * @param name name of the role to select
     * @return an {@code NulRole} object, including information of the role and authorities associated with it.
     */
    @Nullable
    NulRole getRoleByName(String name);

    /**
     * Select a role by its ID, with authorities associated with it.
     * @param id id of the role to select
     * @return an {@code NulRole} object, including information of the role and authorities associated with it.
     */
    @Nullable
    NulRole getRoleById(int id);

    /**
     * Get all roles.
     * @return list of all roles
     */
    @NonNull
    List<NulRole> getAllRoles();

}
